/**
	SUNNY Project, Anyang Normal University, IMP-CAS
	\class TAMBSD
	\brief Slater determinant (SD) class for many-body problems. Each SD represents
	a configuration of the nucleons in the single-particle state.
	\author SUN Yazhou
	\since 2020/01/31
	\date Last modified: 2020/02/11 by Sun Yazhou
	\copyright 2020-2023 SUN Yazhou
	\copyright SUNNY project, Anyang Normal University, IMP-CAS
*/

#ifndef _TAMBSD_h_
#define _TAMBSD_h_

#include "types.h"
#include "TABit.h"

class TASPState;
class TAMBSDManager;

class TAMBSD{
public:
	TAMBSD(ull bit); ///< fPhase is set to 1
	virtual ~TAMBSD();

	int Get2M() const; ///< \retval the total mj*2
	int M() const; ///< \retval the total mj
	bool Parity() const; ///< parity
	char ParityChar() const; ///< \retval '+' for + and '-' for -
	bool pi() const{ return Parity(); } ///< parity
	int Get2T() const; ///< \retval the total tz*2
	int T() const; ///< \retval the total tz
	double GetEnergy() const; ///< \retval the total sp energy
	double e() const{ return GetEnergy(); }
	const TABit &Bit() const{ return fBit; }

	void Print() const; ///< self-display
	void PrintInBit() const; ///< Print the many-body state in bit mode

	void GetSPStateArr(int *p) const; ///< return the spstate array
	const TASPState *operator[](int i) const;
	int GetNParticle() const{ return fBit.count(); }
	/// note that this method works only if piared states are next to each other,
	/// and SPStates are ordered in ManyBodySD
	bool IsPaired() const; ///< \retval if there're broken pairs or not
	void SetBit(ull bit){ fBit = bit; }

	friend class TAMBSDManager;

protected:
	TABit fBit; ///< bit representation of this
};

#endif
